package core.util;

public final class StringUtils {

	private static final String CARRIAGE_RETURN = "\r";

	private static final String NEW_LINE = "\n";

	private StringUtils() {

	}
    
	/**
	 * 过滤掉字符串里的回车和换行符
	 * @param log
	 * @return
	 */
	public static String escapeLog(String log) {
		if (log == null || log.length() == 0) {
			return log;
		}
		if (log.indexOf(CARRIAGE_RETURN) > 0 || log.indexOf(NEW_LINE) > 0) {
			return log.replaceAll(CARRIAGE_RETURN + "|" + NEW_LINE, "");    
		}
		return log;
	}

}
